/*
 * @Author: mikey.zhaopeng
 * @Date:   2016-04-22 15:27:14
 * @Last Modified by:   mikey.zhaopeng
 * @Last Modified time: 2016-04-29 09:56:31
 */

'use strict';

define([
    './baseBean',
], function(
    BaseBean
) {
    function me() {
        BaseBean.apply(this, arguments);
        var self = this;
        this.create = function(params, callback, errorCallback) {
            self.p('/productSet/create', params, function(result) {
                if (callback) {
                    callback(result, params);
                }
            }, errorCallback);
        }

        this.query = function(params, callback, errorCallback) {
            self.p('/productSet/query', params, function(result) {
                if (callback) {
                    if (result.pageIndex) {
                        result.cPage = result.pageIndex;
                    }
                    if (result.pageSize) {
                        result.pSize = result.pageSize;
                    }
                    if (result.totalSize) {
                        result.tSize = result.totalSize;
                    }
                    callback(result, params);
                }
            }, errorCallback);
        }


        this.getMeta = function(params, callback, errorCallback) {
            if (self.cacheMeta) {
                if (callback) {
                    callback(self.cacheMeta, params);
                }
                return;
            }
            self.p('/productSet/getMeta', params, function(result) {
                self.cacheMeta = result;
                if (callback) {
                    callback(result, params);
                }
            }, errorCallback);
        }

        this.preview = function(params, callback, errorCallback) {
            self.p('/productSet/preview', params, function(result) {
                if (callback) {
                    callback(result, params);
                }
            }, errorCallback);
        }




        this.tempData = function() {
            return [{
                "key": "age_group",
                "field": {
                    "en_US_name": "age_group",
                    "type": "String",
                    "value": [
                        "newborn",
                        "infant",
                        "toddler",
                        "kids",
                        "adult"
                    ],
                    "data_type": "facebook"
                },
                "type": "feed"
            }, {
                "key": "availability",
                "field": {
                    "en_US_name": "availability",
                    "type": "String",
                    "value": [
                        "preorder",
                        "in stock",
                        "out of stock",
                        "available for order"
                    ],
                    "data_type": "facebook"
                },
                "type": "feed"
            }, {
                "key": "brand",
                "field": {
                    "en_US_name": "brand",
                    "type": "String",
                    "data_type": "facebook"
                },
                "type": "feed"
            }, {
                "key": "category",
                "field": {
                    "en_US_name": "category",
                    "type": "String",
                    "data_type": "facebook"
                },
                "type": "feed"
            }, {
                "key": "color",
                "field": {
                    "en_US_name": "color",
                    "type": "String",
                    "data_type": "facebook"
                },
                "type": "feed"
            }, {
                "key": "condition",
                "field": {
                    "en_US_name": "condition",
                    "type": "Array",
                    "value": [
                        "new",
                        "refurbished",
                        "used"
                    ],
                    "data_type": "facebook"
                },
                "type": "feed"
            }, {
                "key": "currency",
                "field": {
                    "en_US_name": "currency",
                    "type": "String",
                    "data_type": "facebook"
                },
                "type": "feed"
            }, {
                "key": "custom_label_0",
                "field": {
                    "en_US_name": "custom_label_0",
                    "type": "String",
                    "data_type": "facebook"
                },
                "type": "feed"
            }, {
                "key": "custom_label_1",
                "field": {
                    "en_US_name": "custom_label_1",
                    "type": "String",
                    "data_type": "facebook"
                },
                "type": "feed"
            }, {
                "key": "custom_label_2",
                "field": {
                    "en_US_name": "custom_label_2",
                    "type": "String",
                    "data_type": "facebook"
                },
                "type": "feed"
            }, {
                "key": "custom_label_3",
                "field": {
                    "en_US_name": "custom_label_3",
                    "type": "String",
                    "data_type": "facebook"
                },
                "type": "feed"
            }, {
                "key": "custom_label_4",
                "field": {
                    "en_US_name": "custom_label_4",
                    "type": "String",
                    "data_type": "facebook"
                },
                "type": "feed"
            }, {
                "key": "gender",
                "field": {
                    "en_US_name": "gender",
                    "type": "String",
                    "value": [
                        "male",
                        "female",
                        "unisex"
                    ],
                    "data_type": "facebook"
                },
                "type": "feed"
            }, {
                "key": "material",
                "field": {
                    "en_US_name": "material",
                    "type": "String",
                    "data_type": "facebook"
                },
                "type": "feed"
            }, {
                "key": "name",
                "field": {
                    "en_US_name": "name",
                    "type": "String",
                    "data_type": "facebook"
                },
                "type": "feed"
            }, {
                "key": "pattern",
                "field": {
                    "en_US_name": "pattern",
                    "type": "String",
                    "data_type": "facebook"
                },
                "type": "feed"
            }, {
                "key": "price_amount",
                "field": {
                    "en_US_name": "price_amount",
                    "type": "String",
                    "data_type": "facebook"
                },
                "type": "feed"
            }, {
                "key": "product_feed_id",
                "field": {
                    "en_US_name": "product_feed_id",
                    "type": "String",
                    "data_type": "facebook"
                },
                "type": "feed"
            }, {
                "key": "product_item_id",
                "field": {
                    "en_US_name": "product_item_id",
                    "type": "String",
                    "data_type": "facebook"
                },
                "type": "feed"
            }, {
                "key": "product_group_id",
                "field": {
                    "en_US_name": "product_group_id",
                    "type": "String",
                    "data_type": "facebook"
                },
                "type": "feed"
            }, {
                "key": "product_type",
                "field": {
                    "en_US_name": "product_type",
                    "type": "String",
                    "data_type": "facebook"
                },
                "type": "feed"
            }, {
                "key": "retailer_id",
                "field": {
                    "en_US_name": "retailer_id",
                    "type": "String",
                    "data_type": "facebook"
                },
                "type": "feed"
            }, {
                "key": "retailer_product_group_id",
                "field": {
                    "en_US_name": "retailer_product_group_id",
                    "type": "String",
                    "data_type": "facebook"
                },
                "type": "feed"
            }, {
                "key": "sale_price_amount",
                "field": {
                    "en_US_name": "sale_price_amount",
                    "type": "String",
                    "data_type": "facebook"
                },
                "type": "feed"
            }, {
                "key": "size",
                "field": {
                    "en_US_name": "size",
                    "type": "String",
                    "data_type": "facebook"
                },
                "type": "feed"
            }];
        }

    };
    return new me();
});
